package com.huishu.coupon.controller;


import com.huishu.commons.pojo.Result;
import com.huishu.coupon.service.CouponProductRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author generator@ljj
 * @since 2023-04-10
 */
@RestController
@RequestMapping("/coupon-product-relation")
@Slf4j
public class CouponProductRelationController {

    @Autowired
    private CouponProductRelationService couponProductRelationService;

    @GetMapping("/binding-coupon/{id}/{couponId}")
    public Result bindingCoupon(@PathVariable Long id, @PathVariable Long couponId) {
        log.info("绑定优惠卷：{}", id + ":" + couponId);
        return couponProductRelationService.bindingCoupon(id, couponId);
    }

    @GetMapping("/delete-coupon/{id}/{couponId}")
    public Result deleteCoupon(@PathVariable Long id, @PathVariable Long couponId) {
        log.info("删除优惠卷：{}", id + ":" + couponId);
        return couponProductRelationService.deleteCoupon(id, couponId);
    }
}
